<script type="text/javascript">
function guess_album_path()
{
	var f = document.forms['albumsizes-add-form'];
	var album_id=parseInt(f.elements['albumsizes[album_id]'].value);
	var size_id=parseInt(f.elements['albumsizes[size_id]'].value);
	if(!album_id) { alert('Choose an album first.'); return false; }
	if(!size_id) { alert('Choose a Size ID first.'); return false; }
	
	var album_selected_index = f.elements['albumsizes[album_id]'].selectedIndex;
	var album_name = f.elements['albumsizes[album_id]'].options[album_selected_index].text;
	var size_selected_index = f.elements['albumsizes[size_id]'].selectedIndex;
	var size_name = f.elements['albumsizes[size_id]'].options[size_selected_index].text;
	
	var thumbail_path="{'FTPPATH_THUMBNAILS'|constant}";
	var path=thumbail_path+'/'+album_id+'/'+size_id;
	f.elements['albumsizes[store_location]'].value=path;
	f.elements['albumsizes[store_comments]'].value=album_name+": "+size_name;
	return false;
}
</script>

<div class="top-action">
	<ul class="links">
		<li><a href="albumsizes-list.php">List Album Sizes</a></li>
	</ul>
</div>
<div class="form-wrap">
<form id="albumsizes-add-form" name="albumsizes-add-form" method="post" action="albumsizes-add.php" enctype="multipart/form-data">
<table class="data-editor">
<!--
# document.getElementById('pathhints').innerHTML=this.value;
<tr class="{cycle values='A,B'}">
  <td class="attribute">Hints</td>
  <td><span id="pathhints"></span></td>
  </tr>
-->
<tr class="{cycle values='A,B'}">
  <td class="attribute">Album: <span class="required">*</span></td>
  <td>
	<select name="albumsizes[album_id]">
		<option value="0">-- Chooose an album --</option>
		{html_options options="gallery:albums"|dropdown selected=""}
	</select>
  <img src="images/selected-icons/unlocked.png" class="icon" title="Unlocked albums" alt="Unlocked albums" />
  For which <strong>unlocked</strong> <a href="albums-list.php">album</a>?</td>
  </tr>
<tr class="{cycle values='A,B'}">
  <td class="attribute">Size: <span class="required">*</span></td>
  <td>
	<select name="albumsizes[size_id]">
		<option value="">-- Chooose a size --</option>
		{html_options options="gallery:sizes"|dropdown selected=""}
	</select>
  You cannot use a size more than once per album</td>
  </tr>
<tr class="{cycle values='A,B'}">
  <td class="attribute">Albums Path : <span class="required">*</span></td>
  <td>
	<img src="images/folder_add.png" class="icon" title="Add folder on server" alt="Add folder on server" />
	{'FTPPATH_ALBUMS'|constant} - {'FTPPATH_ALBUMS'|constant|validdirectory}</td>
  </tr>
<tr class="{cycle values='A,B'}">
  <td class="attribute">Thumbnails Path : <span class="required">*</span></td>
  <td>
	<img src="images/folder_add.png" class="icon" title="Add folder on server" alt="Add folder on server" />
	{'FTPPATH_THUMBNAILS'|constant} - {'FTPPATH_THUMBNAILS'|constant|validdirectory}</td>
  </tr>
<tr class="{cycle values='A,B'}">
	<td class="attribute">Store Location: <span class="required">*</span></td>
	<td>
		<input type="text" name="albumsizes[store_location]" value="{$albumsizes.store_location|utf8}" class="input" id="albumsizes-store_location" />
		<span class="form-hints">Where to store the resized images?</span>
	    <a href="#" onclick="return(guess_album_path());">Guess now</a></td>
</tr>

<tr class="{cycle values='A,B'}">
	<td class="attribute">Store Comments: <span class="required">*</span></td>
	<td>
		<input type="text" name="albumsizes[store_comments]" value="{$albumsizes.store_comments|utf8}" class="input" id="albumsizes-store_comments" />
		<span class="form-hints">Readable text to identify this size</span>
	</td>
</tr>
<tr class="{cycle values='A,B'}">
	<td class="attribute">&nbsp;</td>
	<td>
		<input type="text" name="email" value="" class="vanish" />
		<input type="text" name="is_spam" value="" class="vanish" />
		<!--{* 100% sure, only spammers fill these fields, Leave it blank. *}-->
		
		<input type="hidden" name="protection_code" value="{$protection_code}" />
		<input type="hidden" name="add-action" value="Add Album Sizes" />
		<input type="submit" name="submit-button" class="submit" value="Add" />
		<a href="{url::last_page('albumsizes-list.php')}" class="button-cancel">Cancel</a>
	</td>
</tr>
</table>
</form>
</div>
<!-- End of administrators Add -->

<!-- Add validation -->
<script type="text/javascript">
	document.forms['albumsizes-add-form'].elements['albumsizes[album_id]'].value="{$album_id}";
	document.forms['albumsizes-add-form'].elements['albumsizes[size_id]'].value="{$size_id}";
</script>
<script type="text/javascript" src="js/validator/gen_validatorv31.js"></script>
{js src='validators/albumsizes/add.js' validator=true}

<!-- Rich Editor: Remove if not necessary. Or, use different .js files -->
<script type="text/javascript" src="js/tinymce/tiny_mce.js"></script>
<script type="text/javascript" src="js/tinymce-textareas.js"></script>

<!-- End of albumsizes Add -->